package com.yaoq.proxy.interceptor;

import java.lang.reflect.Method;

/**
 * @ClassName MyInterceptor
 * @Description TODO
 * @Author yaoqiang
 * @Date 2020/9/2 9:59
 * @Version 1.0
 */
public class MyInterceptor implements Interceptor {
    /**
     * 拦截器before()
     *
     * @param proxy  代理对象
     * @param target 真实对象
     * @param method 方法
     * @param args   参数
     * @return
     */
    @Override
    public boolean before(Object proxy, Object target, Method method, Object[] args) {
        System.out.println("真实对象执行前逻辑");
        return false;
    }

    @Override
    public void around(Object proxy, Object target, Method method, Object[] args) {
        System.out.println("取代真实对象的方法");
    }

    @Override
    public void after(Object proxy, Object target, Method method, Object[] args) {
        System.out.println("真实对象执行后逻辑");
    }
}
